package com.wgts.wgts.netmodle;

import rx.functions.Action1;

public abstract class HttpResultAction1<T> implements Action1<HttpResult<T>> {
    @Override
    public void call(HttpResult<T> tHttpResult) {
        if (tHttpResult.isSuccess()) {
            onSuccess(tHttpResult.getResult());
        } else {
            _onError(Integer.valueOf(tHttpResult.getCode()), tHttpResult.getMessage());
        }
    }

    public abstract void onSuccess(T t);

    public abstract void _onError(int status,String msg);
}
